﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowPhoto.aspx.cs" Inherits="FrontEnd_ShowPhoto" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
    <script type="text/javascript" src="../Public/Js/jquery-lightbox-0.5/js/jquery.js"></script>
    <script type="text/javascript" src="../Public/Js/jquery-lightbox-0.5/js/jquery.lightbox-0.5.js"></script>
    <link rel="stylesheet" type="text/css" href="../Public/Js/jquery-lightbox-0.5/css/jquery.lightbox-0.5.css" />
    <script type="text/javascript">
        $(function () {
            $('#gallery a').lightBox();
        });
         
    </script>
    <style type="text/css">
        #gallery
        {
            background-color: #444;
            padding: 10px;
            width: 520px;
        }
        #gallery ul
        {
            list-style: none;
        }
        #gallery ul li
        {
            display: inline;
        }
        #gallery ul img
        {
            border: 5px solid #3e3e3e;
            border-width: 5px 5px 20px;
        }
        #gallery ul a:hover img
        {
            border: 5px solid #fff;
            border-width: 5px 5px 20px;
            color: #fff;
        }
        #gallery ul a:hover
        {
            color: #fff;
        }
    </style>
</head>
<body>
    <div id="gallery">
        <ul>
            <% 
                
                if (Request.QueryString["ID"] == null&&Request.QueryString["albumId"]==null) Response.Redirect("Register.aspx");
                string id=null;
                if (Request.QueryString["ID"] != null) id = Request.QueryString["ID"];
                else id = Session["LoginUser"].ToString();
                BLO.User user = new BLO.User(id);
                String albumID = Request.QueryString["albumId"];
                if (BLO.Photo.getListPhotoWithAlbum(user.Info.ID, int.Parse(albumID)).Count == 0)
                {
                    Response.Write("<div>Chưa có album nào</div>");
                }
                else
                {
                    int l = (BLO.Photo.getListPhotoWithAlbum(user.Info.ID, int.Parse(albumID))).Count;
                    for (int i = 0; i < l; i++)
                    {
                        DTO.Photo item = (DTO.Photo)BLO.Photo.getListPhotoWithAlbum(user.Info.ID, int.Parse(albumID))[i];
                        Response.Write("<li><a href='" + ResolveUrl(user.UserDirectory + item.Link) + "'>" + "<img width='72' height='72' src='" + ResolveUrl(user.UserDirectory + item.Link) + "'/></a></li>");

                    }
                }            
            %>
        </ul>
    </div>
</body>
</html>
